import request from "@/utils/request";

export function getNoReadNumber(params) {
  return request({
    url: "/notice/api/v1/userAllNotices/getNoReadNumber",
    method: "get",
    params
  });
}

/**
 * @description: 用户全部通知(未读) /notice/api/v1/userAllNotices/listAllNoRead
 * @param {type}
 * @method:
 * @return:
 * @author: Coder
 */
export function allNoRead(params) {
  return request({
    url: "/notice/api/v1/userAllNotices/listAllNoRead",
    method: "get",
    params
  });
}
/**
 * @description:用户全部通知(未读) /notice/api/v1/userAllNotices/listAllRead
 * @param {type}
 * @method:
 * @return:
 * @author: Coder
 */
export function allRead(params) {
  return request({
    url: "/notice/api/v1/userAllNotices/listAllRead",
    method: "get",
    params
  });
}

/**
 * @description:新增通知分类 /notice/api/v1/noticeGroups

 * @param {type}
 * @method:
 * @return:
 * @author: Coder
 */
export function postNotifyTypeGroup(data) {
  return request({
    url: "/notice/api/v1/noticeGroups",
    method: "POST",
    data
  });
}

/**
 * @description: 获取通知分类 /notice/api/v1/noticeGroups
 * @param {type}
 * @method:
 * @return:
 * @author: Coder
 */
export function getNotifyTypeGroup(params) {
  return request({
    url: "/notice/api/v1/noticeGroups",
    method: "get",
    params
  });
}
/**
 * @description:新增通知类型 /notice/api/v1/noticeTypes
 * @param {type}
 * @method:
 * @return:
 * @author: Coder
 */
export function postNotifyType(data) {
  return request({
    url: "/notice/api/v1/noticeTypes",
    method: "POST",
    data
  });
}
/**
 * @description: 查询通知类型/notice/api/v1/noticeTypes/listAll

 * @param {type}
 * @method:
 * @return:
 * @author: Coder
 */
export function getNotifyType(params) {
  return request({
    url: "/notice/api/v1/noticeTypes/listAll",
    method: "get",
    params
  });
}
/**
 * @description: 查询用户通知设置(包含多级通知分类/通知类型) /notice/api/v1/noticeUserSettings/listAllBySite
 * @param {type}
 * @method:
 * @return:
 * @author: Coder
 */
export function getUserSetNotifyList() {
  return request({
    url: "/notice/api/v1/noticeUserSettings/listAllBySite",
    method: "GET"
  });
}
/**
 * @description: 修改用户通知设置(包含多级通知分类/通知类型) /notice/api/v1/noticeUserSettings
 * @param {type}
 * @method:
 * @return:
 * @author: Coder
 */
export function putUserSetNotifyList(data) {
  return request({
    url: "/notice/api/v1/noticeUserSettings",
    method: "PUT",
    data
  });
}
/**
 * @description: /notice/api/v1/userNotices
分页查询用户接收的通知
 * @param {type}
 * @method:
 * @return:
 * @author: Coder
 */
export function getUserNoticeList(params) {
  return request({
    url: "/notice/api/v1/userNotices",
    method: "GET",
    params
  });
}

// 修改阅读状态
export function hasReadUserNoticeList(id) {
  return request({
    url: "/notice/api/v1/userNotices/updateReadStatu/" + id,
    method: "PUT"
  });
}

export class notify {
  /*
/notice/api/v1/userNotices/{userNoticeId}
删除单个用户接收的通知，彻底删除 */
  static deleteItem = "/notice/api/v1/userNotices/";
  static deleteAll = "/notice/api/v1/userNotices";
  // notice/api/v1/userMsgs 分页查询用户接收的消息站内信
  // notice/api/v1/userMsgs/listAll 查询用户接收的消息站内信
  // notice/api/v1/userMsgs/updateReadStatu/{userMsgId}修改阅读状态
  // static mailPageList = "/notice/api/v1/userMsgs/";
  static mailListAll = "/notice/api/v1/userMsgs/listAll";
  static mailPageDetailStatus = "/notice/api/v1/userMsgs/updateReadStatu/";
  // /notice/api/v1/userReadSysNotices分页查询用户系统公告
  // /notice/api/v1/userReadSysNotices/listAll查询用户系统公告
  // notice/api/v1/userReadSysNotices新增用户已阅系统公告
  // notice/api/v1/userReadSysNotices/findBySysNoticeId/{sysNoticeId}公告详情
  static publicPageList = "/notice/api/v1/userReadSysNotices/";
  static publicListAll = "/notice/api/v1/userReadSysNotices/listAll";
  static publicPageListRead = "/notice/api/v1/userReadSysNotices";
  // static publicDetail = "/notice/api/v1/userReadSysNotices/findBySysNoticeId/";
  // notice/api/v1/peoplealLetter分页查询@我信息
  // notice/api/v1/peoplealLetter修改@我信息
  // notice/api/v1/peoplealLetter/listAll查询@我信息
  static me = "/notice/api/v1/peoplealLetter/";
  static meListAll = "/notice/api/v1/peoplealLetter/listAll";
  // 通知列表
  static notifyListAll = "/notice/api/v1/userNotices/listAll";
  // notice/api/v1/noticeUserSettings/updateAllUserSetting/{wayType}/{defaultValue}
  // 修改系统中全部用户通知设置的值
  static notifyAllType = "/notice/api/v1/noticeUserSettings/updateAllUserSetting/";
  // notice/api/v1/noticeUserSettings/updateUserSetting/{noticeTypeId}/{wayType}/{defaultValue}
  // 修改通知用户设置的值
  static notifyUserType = "/notice/api/v1/noticeUserSettings/updateUserSetting/";
  // notice/api/v1/noticeUserSettings/updateUserSettingByGroup/{noticeGroupId}/{wayType}/{defaultValue}修改通知分类下通知用户设置的值

  static notifyGroupType = "/notice/api/v1/noticeUserSettings/updateUserSettingByGroup/";

  // 站内信设置 /notice/api/v1/msgUserSettings/listAllBySit查询用户消息设置(包含多级消息分类/消息类型)
  // static msgEmail = "/notice/api/v1/msgUserSettings/listAllBySite";

  static msgGroupType = "/notice/api/v1/msgUserSettings/updateUserSettingByGroup/"; // 站内信消息分类

  static msgUserType = "/notice/api/v1/msgUserSettings/updateUserSetting/"; // 站内信消息分类下消息类型

  static msgAllType = "/notice/api/v1/msgUserSettings/updateAllUserSetting/"; // 站内信类型

  static msgClassifyGroup = "/notice/api/v1/msgGroups/"; // 设置消息分类

  static msgClassify = "/notice/api/v1/msgTypes/"; // 设置消息
}

// 获取站内信设置
export function msgUserBySite(params) {
  return request({
    url: "/notice/api/v1/msgUserSettings/listAllBySite",
    method: "get",
    params
  });
}

// 修改站内信设置
export function updateAllUserSetting(data) {
  return request({
    url: "/notice/api/v1/msgUserSettings/updateAllUserSetting/",
    method: "put",
    data
  });
}

// 消息通知设置
export function updateNoticeUserSetting(id, type, value) {
  return request({
    url: `/notice/api/v1/noticeUserSettings/updateUserSetting/${id}/${type}/${value}`,
    method: "put"
  });
}

// 修改设置
export function updateUserSettingByGroup(id, type, value) {
  return request({
    url: `/notice/api/v1/msgUserSettings/updateUserSettingByGroup/${id}/${type}/${value}`,
    method: "put"
  });
}

//
export function updateNoticeSettingByGroup(id, type, value) {
  return request({
    url: `/notice/api/v1/noticeUserSettings/updateUserSettingByGroup/${id}/${type}/${value}`,
    method: "put"
  });
}

// 修改通知已阅读
export function updateMsgReadStatu(id, data) {
  return request({
    url: `/notice/api/v1/userMsgs/updateReadStatu/${id}`,
    method: "put",
    data
  });
}

// 修改系统公告已阅读
export function postSysReadStatus(sysNoticeId) {
  return request({
    url: `/notice/api/v1/userReadSysNotices/readSysNotice/${sysNoticeId}`,
    method: "put"
  });
}

export function peoplealLetter(data) {
  return request({
    url: `/notice/api/v1/peoplealLetter`,
    method: "put",
    data
  });
}

/** ****详情*******/
// 根据用户接收的通知id查询用户接收的通知详情
export function getUserNoticeListDetail(id) {
  return request({
    url: "/notice/api/v1/userNotices/" + id,
    method: "GET"
  });
}

// 根据系统公告id查询系统公告详情
export function getSysNoticeDetail(sysNoticeId) {
  return request({
    url: `/notice/api/v1/sysNotices/${sysNoticeId}`,
    method: "GET"
  });
}

// /notice/api/v1/userReadSysNotices
